/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package quartz;

import org.quartz.Job;
import org.quartz.JobDataMap;
import org.quartz.JobDetail;

/**
 *
 * @author bighead
 */
public class JobBuilder {

    public static final String DEFAULT_JOB_GROUP_NAME = "DefaultJobGroup";

    public static JobDetail buildJobDetail(String jobName, String jobGroupName, Job job, JobDataMap jobDataMap) {
        JobDetail jobDetail = new JobDetail(jobName, jobGroupName, job.getClass());
        jobDetail.setJobDataMap(jobDataMap);
        return jobDetail;
    }

    public static JobDetail buildJobDetail(String jobName, String jobGroupName, Job job) {
        return buildJobDetail(jobName, jobGroupName, job, null);
    }

    public static JobDetail buildJobDetail(String jobName, Job job) {
        return buildJobDetail(jobName, DEFAULT_JOB_GROUP_NAME, job, null);
    }

    public static JobDetail buildJobDetail(String jobName, Job job, JobDataMap jobDataMap) {
        return buildJobDetail(jobName, DEFAULT_JOB_GROUP_NAME, job, jobDataMap);
    }

}
